package com.xja.shoppingmall.controller;

import com.xja.shoppingmall.annotation.IgnoreResponseAdvice;
import com.xja.shoppingmall.goods.GoodsVo;
import com.xja.shoppingmall.service.GoodService;
import com.xja.shoppingmall.vo.CommonResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.web.bind.annotation.*;

/**
 * @author CHENCHEN
 * @title
 * @createTime 2021-12-1520:32
 */
@Api(tags = "商品管理")
@Slf4j
@RestController
@RequestMapping("goods-module")
public class GoodsController {

    @Autowired
    private GoodService goodService;


    @ApiOperation(value="库存变更", notes = "根据商品ID减库存",
    httpMethod = "POST")
    @PostMapping("updateGoodsCount")
    public CommonResponseVO updateGoodsCount(@RequestBody GoodsVo goodsVo,
                                             @RequestHeader("authority") String token){

        return goodService.updateGoodCount(token, goodsVo);
    }
}
